package com.sharing.util;

import com.sharing.domain.User;

import javax.jws.soap.SOAPBinding;

/**
 * @author MingTian
 * @version 1.0
 * @description TODO 通过封装ThreadLocal线程安全类存储当前登录用户信息
 * @date 2023/4/10 9:58
 */
public class ThreadLocalStorage {
    private static final ThreadLocal<User> threadLocal = new ThreadLocal<>();

    public static User getUser() {
        return threadLocal.get();
    }

    public static void setUser(User user) {
        threadLocal.set(user);
    }

    public static void removeUser() {
        threadLocal.remove();
    }
}
